package com.customer.mapper;


import com.customer.dto.UserPageQueryDTO;
import com.customer.entity.User;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    /**
     * 校验用户密码
     * @param username 用户名
     * @param password 密码
     * @return 用户信息
     */
    @Select("select * from user where username=#{username} and password=#{password}")
    User getByUsernameAndPassword(String username, String password);


    /**
     * 根据用户名查询用户
     * @param username
     * @return
     */
    @Select("select * from user where username=#{username}")
    User getByUsername(String username);

    /**
     * 新增用户
     * @param user
     */
    void insert(User user);
    
    /**
     * 修改用户信息
     * @param user
     */
    void update(User user);
    
    /**
     * 根据id查询用户
     * @param id
     * @return
     */
    @Select("select * from user where id=#{id}")
    User getById(Long id);
}
